/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package negocio;

import datos.LogueoDB;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Angelica
 */
public class Logueos {
    
    private ArrayList ciudades=new ArrayList();

    public ArrayList getCiudades() {
        return ciudades;
    }

    public void setCiudades(ArrayList ciudades) {
        this.ciudades = ciudades;
    }
    
    public void listar() {
        try {
            LogueoDB logueoDB = new LogueoDB();
            setCiudades(logueoDB.listar());
        } catch (SQLException ex) {
            Logger.getLogger(Logueo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    
        public void grabar(Logueo logueo) {
        try {
            LogueoDB logueoDB = new LogueoDB();
            logueoDB.grabar(logueo);
        } catch (SQLException ex) {
            //Logger.getLogger(Logueo.class.getName()).log(Level.SEVERE, null, ex);
            JOptionPane.showMessageDialog(null, "ERROR !!! LA CEDULA QUE INGRESO NO EXISTE EN USUARIOS");
        }
    }

    public void modificar(Logueo logueo) {
        try {
        LogueoDB logueoDB = new LogueoDB();
            logueoDB.modificar(logueo);
        } catch (SQLException ex) {
            Logger.getLogger(Logueo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }


    
        public Coordinador buscarCoordinador(String cedula) {
        Coordinador aux=null;
            try {            
            LogueoDB usuarioDB = new LogueoDB();
            aux = usuarioDB.buscarContraseniaCoordinador(cedula);            
        } catch (SQLException ex) {
            Logger.getLogger(Logueo.class.getName()).log(Level.SEVERE, null, ex);
        }
        return aux;
    }
        
        
     public Operador buscarOperador(String cedula) {
        Operador aux=null;
            try {            
            LogueoDB usuarioDB = new LogueoDB();
            aux = usuarioDB.buscarContraseniaOperador(cedula);            
        } catch (SQLException ex) {
            Logger.getLogger(Operador.class.getName()).log(Level.SEVERE, null, ex);
        }
        return aux;
    }
}
